import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请输入");
            Scanner A  = new Scanner(System.in);
            String sc=A.next();
            if(sc.matches("([01][0-9])|(2[0-3]):[0-5][0-9]")){
                System.out.println("有效");
                break;
            }
            else {
                System.out.println("无效");
            }
        }
    }


}
